package mini_v340

import io.gatling.core.Predef._
import io.gatling.core.structure.ChainBuilder
import io.gatling.http.Predef._

/**
  * Created by chenbo on 2018/9/6.
  */
object Cart {

  def add_cart:ChainBuilder={

    val data:Map[String,Any]=Map(
      "ChannelSysNo"->"1",
      "ProductBasicSysNo"->"${basic}",
      "Quantity"->"1",
      "SaleChannelSysNo"->"1"
    )

    return exec(
      conf.Request.post(conf.Config.Cart,data)
        .check( jsonPath("$..msg").is("success"))
      ).pace(3)

  }

  def cart=exec(

    conf.Request.get(conf.Config.Cart)
      .check( jsonPath("$..msg").is("success"))
//      .check( jsonPath("$..value").saveAs("cart_value"))

  ).pace(3)

  def cart_count=exec(

    conf.Request.get(conf.Config.CartCount)
      .check( jsonPath("$..msg").is("success"))

  )
}
